<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
var azZza=[22,33,[44,55,[222]]];
console.log(azZza.flat(2));


var azZa=[22,33,[44,55,[222]],22,33,[22,33,[44,55,[222]],44,55,[222]]];
console.log(azZa.flat(Infinity));
</script>
</html>